<?xml version="1.0" encoding="utf-8" ?>
<!-- openEHR Release 1.0.1 Structure XML schema -->
<!-- Authored by Ocean Informatics 2007.04.13  -->
<xs:schema version="v1.0.1" targetNamespace="http://schemas.openehr.org/v1"
	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns="http://schemas.openehr.org/v1" id="Structure.xsd">
	<xs:include schemaLocation="BaseTypes.xsd"/>

	<xs:element name="items" type="LOCATABLE"/>
	<xs:complexType name="LOCATABLE" abstract="true">
		<xs:sequence>
			<xs:element name="name" type="DV_TEXT"/>
			<xs:element name="uid" type="UID_BASED_ID" minOccurs="0"/>
			<xs:element name="links" type="LINK" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="archetype_details" type="ARCHETYPED" minOccurs="0" maxOccurs="1"/>
			<xs:element name="feeder_audit" type="FEEDER_AUDIT" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="archetype_node_id" type="archetypeNodeId" use="required"/>
	</xs:complexType>
	<xs:complexType name="ARCHETYPED">
		<xs:sequence>
			<xs:element name="archetype_id" type="ARCHETYPE_ID"/>
			<xs:element name="template_id" type="TEMPLATE_ID" minOccurs="0" maxOccurs="1"/>
			<xs:element name="rm_version" type="xs:string"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="LINK">
		<xs:sequence>
			<xs:element name="meaning" type="DV_TEXT"/>
			<xs:element name="type" type="DV_TEXT"/>
			<xs:element name="target" type="DV_EHR_URI"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="FOLDER">
		<xs:complexContent>
			<xs:extension base="LOCATABLE">
				<xs:sequence>
					<xs:element name="folders" type="FOLDER" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="items" type="OBJECT_REF" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="HISTORY">
		<xs:complexContent>
			<xs:extension base="LOCATABLE">
				<xs:sequence>
					<xs:element name="origin" type="DV_DATE_TIME" minOccurs="1" maxOccurs="1"/>
					<xs:element name="period" type="DV_DURATION" minOccurs="0"/>
					<xs:element name="duration" type="DV_DURATION" minOccurs="0"/>
					<xs:element name="events" type="EVENT" minOccurs="0" maxOccurs="unbounded"/>
					<xs:element name="summary" type="ITEM_STRUCTURE" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="EVENT" abstract="true">
		<xs:complexContent>
			<xs:extension base="LOCATABLE">
				<xs:sequence>
					<xs:element name="time" type="DV_DATE_TIME"/>
					<xs:element name="data" type="ITEM_STRUCTURE"/>
					<xs:element name="state" type="ITEM_STRUCTURE" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="POINT_EVENT">
		<xs:complexContent>
			<xs:extension base="EVENT"/>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="INTERVAL_EVENT">
		<xs:complexContent>
			<xs:extension base="EVENT">
				<xs:sequence>
					<xs:element name="width" type="DV_DURATION"/>
					<xs:element name="sample_count" type="xs:int" minOccurs="0"/>
					<xs:element name="math_function" type="DV_CODED_TEXT"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ITEM_STRUCTURE" abstract="true">
		<xs:complexContent>
			<xs:extension base="LOCATABLE"/>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ITEM_SINGLE">
		<xs:complexContent>
			<xs:extension base="ITEM_STRUCTURE">
				<xs:sequence>
					<xs:element name="item" type="ELEMENT"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ITEM_LIST">
		<xs:complexContent>
			<xs:extension base="ITEM_STRUCTURE">
				<xs:sequence>
					<xs:element name="items" type="ELEMENT" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ITEM_TREE">
		<xs:complexContent>
			<xs:extension base="ITEM_STRUCTURE">
				<xs:sequence>
					<xs:element name="items" type="ITEM" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ITEM_TABLE">
		<xs:complexContent>
			<xs:extension base="ITEM_STRUCTURE">
				<xs:sequence>
					<xs:element name="rows" type="CLUSTER" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ITEM" abstract="true">
		<xs:complexContent>
			<xs:extension base="LOCATABLE">
				<xs:sequence/>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="CLUSTER">
		<xs:complexContent>
			<xs:extension base="ITEM">
				<xs:sequence>
					<xs:element name="items" type="ITEM" maxOccurs="unbounded"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
	<xs:complexType name="ELEMENT">
		<xs:complexContent>
			<xs:extension base="ITEM">
				<xs:sequence>
					<xs:element name="value" type="DATA_VALUE" minOccurs="0"/>
					<xs:element name="null_flavour" type="DV_CODED_TEXT" minOccurs="0"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>
